package com.bd.scm.dao.mapper.schedule;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bd.scm.domain.dto.mobile.GroupAttendanceDto;
import com.bd.scm.domain.dto.schedule.*;
import com.bd.scm.domain.models.door.DoorInfo;
import com.bd.scm.domain.models.schedule.Schedule;
import com.bd.scm.domain.models.schedule.UserDateSchedule;
import com.bd.scm.domain.models.schedule.UserDateScheduleDetails;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: _Cps
 * Date: 2019.12.09 16:29
 */
public interface ScheduleMapper extends BaseMapper<Schedule> {

    List<ScheduleFailDto> addScheduleGuiLv(ScheduleDto scheduleDto);

    List<ScheduleFailDto> addSchedulePuTong(ScheduleDto scheduleDto);

    Integer addScheduleGeRen(ScheduleDto scheduleDto);

    List<ScheduleFailDto> updateScheduleByList(
            @Param("shiftInfoJSON") String shiftInfoJSON,
            @Param("ip") String ip,
            @Param("operator") String operator
    );

    List<ScheduleFailDto> updateCalendarScheduleByList(
            @Param("shiftInfoJSON") String shiftInfoJSON,
            @Param("ip") String ip,
            @Param("operator") String operator
    );

    List<ScheduleFailDto> updateScheduleByDate(ScheduleDto scheduleDto);

    List<ScheduleFailDto> deleteSchedule(ScheduleDto scheduleDto);

    Integer deleteScheduleFind(ScheduleDto scheduleDto);

    IPage<Schedule> getScheduleList(Page<Schedule> page, ScheduleDto scheduleDto);

    List<Schedule> getScheduleGuiLv(@Param("findDeptid") String findDeptid);

    List<Schedule> getSchedulePuTong(@Param("findDeptid") String findDeptid);

    Integer clearScheduleReceive();

    Integer addReceiveSchedule(@Param("list") List<ImportScheduleDto> subList, @Param("bh") String bh);

    List<ImportScheduleErrorDto> execReceiveScheduleSync(String bh, String ip, String operator);


    IPage<Schedule> getExportScheduleList(Page<Schedule> page, ScheduleDto scheduleDto);

    JSONObject getBanci(ScheduleDto scheduleDto);

    /**
     * 管理员考勤查询
     *
     * @param groupId
     * @param shiftNo
     * @param startDate
     * @param endDate
     * @return
     */
    List<GroupAttendanceDto> getGroupAttendanceStats(@Param("groupId") int groupId,
                                               @Param("shiftNo") String shiftNo,
                                               @Param("startDate") String startDate,
                                               @Param("endDate") String endDate,
                                               @Param("userNoOrName") String userNoOrName);

    /**
     * 个人排班某月份查询
     * @param userDateScheduleDto
     * @return
     */
    List<UserDateSchedule> getUserDateSchedule(UserDateScheduleDto userDateScheduleDto);

    /**
     * 个人排班某天详情
     * @param userDateScheduleDetailsDto
     * @return
     */
    UserDateScheduleDetails getUserDateScheduleDetails(UserDateScheduleDetailsDto userDateScheduleDetailsDto);

}
